Optimal. Leaf size=105 \[ -\frac {2 a^2 (3 A-5 i B)}{3 d \sqrt {\cot (c+d x)}}+\frac {4 \sqrt [4]{-1} a^2 (B+i A) \tanh ^{-1}\left ((-1)^{3/4} \sqrt {\cot (c+d x)}\right )}{d}+\frac {2 i B \left (a^2 \cot (c+d x)+i a^2\right )}{3 d \cot ^{\frac {3}{2}}(c+d x)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.33, antiderivative size = 105, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 36, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.139, Rules used = {3581, 3593, 3591, 3533, 208} \[ -\frac {2 a^2 (3 A-5 i B)}{3 d \sqrt {\cot (c+d x)}}+\frac {4 \sqrt [4]{-1} a^2 (B+i A) \tanh ^{-1}\left ((-1)^{3/4} \sqrt {\cot (c+d x)}\right )}{d}+\frac {2 i B \left (a^2 \cot (c+d x)+i a^2\right )}{3 d \cot ^{\frac {3}{2}}(c+d x)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 208
Rule 3533
Rule 3581
Rule 3591
Rule 3593
Rubi steps
\begin {align*} \int \sqrt {\cot (c+d x)} (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=\int \frac {(i a+a \cot (c+d x))^2 (B+A \cot (c+d x))}{\cot ^{\frac {5}{2}}(c+d x)} \, dx\\ &=\frac {2 i B \left (i a^2+a^2 \cot (c+d x)\right )}{3 d \cot ^{\frac {3}{2}}(c+d x)}+\frac {2}{3} \int \frac {(i a+a \cot (c+d x)) \left (\frac {1}{2} a (3 i A+5 B)+\frac {1}{2} a (3 A-i B) \cot (c+d x)\right )}{\cot ^{\frac {3}{2}}(c+d x)} \, dx\\ &=-\frac {2 a^2 (3 A-5 i B)}{3 d \sqrt {\cot (c+d x)}}+\frac {2 i B \left (i a^2+a^2 \cot (c+d x)\right )}{3 d \cot ^{\frac {3}{2}}(c+d x)}+\frac {2}{3} \int \frac {3 a^2 (i A+B)+3 a^2 (A-i B) \cot (c+d x)}{\sqrt {\cot (c+d x)}} \, dx\\ &=-\frac {2 a^2 (3 A-5 i B)}{3 d \sqrt {\cot (c+d x)}}+\frac {2 i B \left (i a^2+a^2 \cot (c+d x)\right )}{3 d \cot ^{\frac {3}{2}}(c+d x)}+\frac {\left (12 a^4 (i A+B)^2\right ) \operatorname {Subst}\left (\int \frac {1}{-3 a^2 (i A+B)+3 a^2 (A-i B) x^2} \, dx,x,\sqrt {\cot (c+d x)}\right )}{d}\\ &=\frac {4 \sqrt [4]{-1} a^2 (i A+B) \tanh ^{-1}\left ((-1)^{3/4} \sqrt {\cot (c+d x)}\right )}{d}-\frac {2 a^2 (3 A-5 i B)}{3 d \sqrt {\cot (c+d x)}}+\frac {2 i B \left (i a^2+a^2 \cot (c+d x)\right )}{3 d \cot ^{\frac {3}{2}}(c+d x)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 4.33, size = 254, normalized size = 2.42 \[ \frac {a^2 e^{-i (c-d x)} \sqrt {\cot (c+d x)} \left (A \left (1+e^{2 i (c+d x)}\right )-i B \left (-1+e^{2 i (c+d x)}\right )\right ) \left (\left (-1+e^{2 i (c+d x)}\right ) \left (3 i A \left (1+e^{2 i (c+d x)}\right )+B \left (5+7 e^{2 i (c+d x)}\right )\right )-6 i (A-i B) \sqrt {\frac {-1+e^{2 i (c+d x)}}{1+e^{2 i (c+d x)}}} \left (1+e^{2 i (c+d x)}\right )^2 \tanh ^{-1}\left (\sqrt {\frac {-1+e^{2 i (c+d x)}}{1+e^{2 i (c+d x)}}}\right )\right )}{3 d \left (e^{2 i c+3 i d x}+e^{i d x}\right )^2 (A \cos (c+d x)+B \sin (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.52, size = 436, normalized size = 4.15 \[ \frac {3 \, \sqrt {\frac {{\left (-16 i \, A^{2} - 32 \, A B + 16 i \, B^{2}\right )} a^{4}}{d^{2}}} {\left (d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \log \left (-\frac {{\left (4 \, {\left (A - i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + \sqrt {\frac {{\left (-16 i \, A^{2} - 32 \, A B + 16 i \, B^{2}\right )} a^{4}}{d^{2}}} {\left (d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )} \sqrt {\frac {i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} - 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{{\left (2 i \, A + 2 \, B\right )} a^{2}}\right ) - 3 \, \sqrt {\frac {{\left (-16 i \, A^{2} - 32 \, A B + 16 i \, B^{2}\right )} a^{4}}{d^{2}}} {\left (d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \log \left (-\frac {{\left (4 \, {\left (A - i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - \sqrt {\frac {{\left (-16 i \, A^{2} - 32 \, A B + 16 i \, B^{2}\right )} a^{4}}{d^{2}}} {\left (d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )} \sqrt {\frac {i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} - 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{{\left (2 i \, A + 2 \, B\right )} a^{2}}\right ) + {\left ({\left (24 i \, A + 56 \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} - 16 \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-24 i \, A - 40 \, B\right )} a^{2}\right )} \sqrt {\frac {i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} - 1}}}{12 \, {\left (d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (B \tan \left (d x + c\right ) + A\right )} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{2} \sqrt {\cot \left (d x + c\right )}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [C] time = 2.06, size = 888, normalized size = 8.46 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [B] time = 2.08, size = 180, normalized size = 1.71 \[ \frac {3 \, {\left (2 \, \sqrt {2} {\left (-\left (i + 1\right ) \, A + \left (i - 1\right ) \, B\right )} \arctan \left (\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} + \frac {2}{\sqrt {\tan \left (d x + c\right )}}\right )}\right ) + 2 \, \sqrt {2} {\left (-\left (i + 1\right ) \, A + \left (i - 1\right ) \, B\right )} \arctan \left (-\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} - \frac {2}{\sqrt {\tan \left (d x + c\right )}}\right )}\right ) - \sqrt {2} {\left (\left (i - 1\right ) \, A + \left (i + 1\right ) \, B\right )} \log \left (\frac {\sqrt {2}}{\sqrt {\tan \left (d x + c\right )}} + \frac {1}{\tan \left (d x + c\right )} + 1\right ) + \sqrt {2} {\left (\left (i - 1\right ) \, A + \left (i + 1\right ) \, B\right )} \log \left (-\frac {\sqrt {2}}{\sqrt {\tan \left (d x + c\right )}} + \frac {1}{\tan \left (d x + c\right )} + 1\right )\right )} a^{2} - 4 \, {\left (B a^{2} + \frac {3 \, {\left (A - 2 i \, B\right )} a^{2}}{\tan \left (d x + c\right )}\right )} \tan \left (d x + c\right )^{\frac {3}{2}}}{6 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [F] time = 0.00, size = -1, normalized size = -0.01 \[ \int \sqrt {\mathrm {cot}\left (c+d\,x\right )}\,\left (A+B\,\mathrm {tan}\left (c+d\,x\right )\right )\,{\left (a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}^2 \,d x \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ - a^{2} \left (\int \left (- A \sqrt {\cot {\left (c + d x \right )}}\right )\, dx + \int A \tan ^{2}{\left (c + d x \right )} \sqrt {\cot {\left (c + d x \right )}}\, dx + \int \left (- B \tan {\left (c + d x \right )} \sqrt {\cot {\left (c + d x \right )}}\right )\, dx + \int B \tan ^{3}{\left (c + d x \right )} \sqrt {\cot {\left (c + d x \right )}}\, dx + \int \left (- 2 i A \tan {\left (c + d x \right )} \sqrt {\cot {\left (c + d x \right )}}\right )\, dx + \int \left (- 2 i B \tan ^{2}{\left (c + d x \right )} \sqrt {\cot {\left (c + d x \right )}}\right )\, dx\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________